﻿<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <%- include('includes/head',{title:'Add new post}) %>
    <link rel="stylesheet" href="/styles/forms.css">
</head>
<body>
<%- include('includes/header') %>
<main>
    <h1>Add a new post</h1>
    <form action="/posts" method="POST">
        <div class="form-control">
            <label for="title">Title</label>
            <input type="text" name="title" id="title" required>
        </div>
        <div class="form-control">
            <label for="summary">Summary</label>
            <input type="text" name="summary" id="summary" required maxlength="255">
        </div>
        <div class="form-control">
            <label for="content">Post Content</label>
            <textarea name="content" id="content" required rows="3"></textarea>
        </div>
        <div class="form-control">
            <label for="author">Select Author</label>
            <select name="author" id="author">
                <% for(const author of authors) { %>
                    <option value="<%= author.id %>"><%= author.name %></option>
                <% } %>
            </select>
        </div>
        <button class="btn">Add Post</button>
    </form>
</main>
</body>
</html>